<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学术研究自动化系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            line-height: 1.6;
            color: #333;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem;
        }
        
        .header {
            text-align: center;
            color: white;
            margin-bottom: 3rem;
        }
        
        .header h1 {
            font-size: 3rem;
            margin-bottom: 1rem;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }
        
        .header p {
            font-size: 1.2rem;
            opacity: 0.9;
        }
        
        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin-bottom: 3rem;
        }
        
        .feature-card {
            background: white;
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            transition: transform 0.3s ease;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
        }
        
        .feature-card h3 {
            color: #667eea;
            margin-bottom: 1rem;
            font-size: 1.3rem;
        }
        
        .feature-card p {
            color: #666;
            margin-bottom: 1rem;
        }
        
        .status-panel {
            background: white;
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            text-align: center;
        }
        
        .status-indicator {
            display: inline-block;
            width: 12px;
            height: 12px;
            background: #4CAF50;
            border-radius: 50%;
            margin-right: 8px;
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }
        
        .btn {
            display: inline-block;
            padding: 12px 24px;
            background: #667eea;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s ease;
            border: none;
            cursor: pointer;
            font-size: 1rem;
        }
        
        .btn:hover {
            background: #5a6fd8;
        }
        
        .quick-actions {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
            margin-top: 2rem;
        }
        
        .footer {
            text-align: center;
            color: white;
            margin-top: 3rem;
            opacity: 0.8;
        }
        
        @media (max-width: 768px) {
            .header h1 {
                font-size: 2rem;
            }
            
            .container {
                padding: 1rem;
            }
            
            .quick-actions {
                flex-direction: column;
                align-items: center;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🔬 学术研究自动化系统</h1>
            <p>智能化研究辅助平台，提升研究效率，简化研究流程</p>
        </div>
        
        <div class="features">
            <div class="feature-card">
                <h3>📋 智能研究规划</h3>
                <p>自动生成研究计划和时间线，智能识别研究重点和潜在风险</p>
            </div>
            
            <div class="feature-card">
                <h3>📚 文献智能分析</h3>
                <p>智能搜索、筛选和分析学术文献，构建知识图谱</p>
            </div>
            
            <div class="feature-card">
                <h3>🧪 实验设计辅助</h3>
                <p>智能生成实验方案，参数优化和可行性评估</p>
            </div>
            
            <div class="feature-card">
                <h3>📊 数据自动分析</h3>
                <p>自动化数据处理、分析和可视化，提取关键洞察</p>
            </div>
            
            <div class="feature-card">
                <h3>📝 报告智能生成</h3>
                <p>自动生成符合学术标准的研究报告，支持多种格式</p>
            </div>
            
            <div class="feature-card">
                <h3>👥 协作管理</h3>
                <p>支持多人实时协作、版本控制和项目管理</p>
            </div>
        </div>
        
        <div class="status-panel">
            <h3>系统状态</h3>
            <p>
                <span class="status-indicator"></span>
                <span id="system-status">系统运行正常</span>
            </p>
            <p id="system-info">版本: v1.0.0 | 在线用户: 1</p>
            
            <div class="quick-actions">
                <button class="btn" onclick="createProject()">创建新项目</button>
                <button class="btn" onclick="window.location.href='/projects'">项目管理</button>
                <button class="btn" onclick="searchLiterature()">文献搜索</button>
                <button class="btn" onclick="viewDocs()">查看文档</button>
            </div>
        </div>
        
        <div class="footer">
            <p>© 2025 学术研究自动化系统 | 
               <a href="docs/user_manual.md" style="color: white;">使用手册</a> | 
               <a href="docs/api_reference.md" style="color: white;">API文档</a>
            </p>
        </div>
    </div>
    
    <script>
        // 检查系统状态
        async function checkSystemStatus() {
            try {
                const response = await fetch('/api/status');
                const data = await response.json();
                document.getElementById('system-status').textContent = data.message;
            } catch (error) {
                document.getElementById('system-status').textContent = '系统连接异常';
                document.querySelector('.status-indicator').style.background = '#f44336';
            }
        }
        
        // 创建项目
        function createProject() {
            window.location.href = '/projects';
        }
        
        // 文献搜索
        async function searchLiterature() {
            const keywords = prompt('请输入搜索关键词（用逗号分隔）:');
            if (keywords) {
                try {
                    const keywordList = keywords.split(',').map(k => k.trim());
                    const response = await fetch('/api/literature/search', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json'
                        },
                        body: JSON.stringify({ keywords: keywordList })
                    });
                    const data = await response.json();
                    if (data.success) {
                        alert(`搜索完成！找到 ${data.total_results} 篇相关文献`);
                    }
                } catch (error) {
                    alert('搜索失败，请稍后重试');
                }
            }
        }
        
        // 查看文档
        function viewDocs() {
            window.open('docs/user_manual.md', '_blank');
        }
        
        // 页面加载时检查系统状态
        document.addEventListener('DOMContentLoaded', function() {
            checkSystemStatus();
            // 每30秒检查一次系统状态
            setInterval(checkSystemStatus, 30000);
        });
    </script>
</body>
</html>